<?php

function news_2_cols_shortcode( $atts, $content = null ) {
	
	extract(shortcode_atts(array(
		"category" => '',
	), $atts));
	
	global $wp_query,$paged,$post;
	$temp = $wp_query;
	$wp_query= null;
	$wp_query = new WP_Query();
	
	$query .= '&posts_per_page=1';
	
	if( $atts['category'] ) { $query .= '&category_name=' . $atts['category']; }
	
	if(!empty($query)){
		$query .= $query;
	}
	
	$wp_query->query($query);
	ob_start();
	?>
	
	<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
		<?php get_template_part( 'loop', 'style6' ); ?>
	<?php endwhile; ?>
	
	<?php $wp_query = null; $wp_query = $temp;
	$content = ob_get_contents();
	ob_end_clean();
	
	return $content;
	
}

add_shortcode( 'news_2_cols', 'news_2_cols_shortcode' );

function news_2_cols_wrapper_shortcode( $atts, $content = null ) {
	
	extract(shortcode_atts(array(
		"bottom" => '',
	), $atts));
	
	if( $atts['bottom'] == 'true' ) { 
		$output = '<ul class="news-block-columns-2 clearfix" style="margin: 0 !important;">';
	} else {
		$output = '<ul class="news-block-columns-2 clearfix">';
	}
	
	$output .= do_shortcode($content);
	$output .= '</ul>';
	return $output;
}

add_shortcode( 'news_2_cols_wrapper', 'news_2_cols_wrapper_shortcode' );

?>